package ${basePackage}.service.impl;

import ${basePackage}.${interface}.${domainNameUpperCamel}${interfaceType};
import ${basePackage}.entity.${domainNameUpperCamel}${entity};
import ${basePackage}.service.${domainNameUpperCamel}Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;


import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

/**
 * ${description} Interface implementation
 * @Author ${author}
 * @Data ${date}
 */
@Service
public class ${domainNameUpperCamel}ServiceImpl  implements ${domainNameUpperCamel}Service {
    @Resource
    private ${domainNameUpperCamel}${interfaceType} ${domainNameLowerCamel}${interfaceType};

    /**
     *  insert
     *  @Author ${author}
     *  @Date ${date}
     *  @param record  Entity class
     */
    @Override
    public boolean insert(${domainNameUpperCamel}${entity} record)  {
        return ${domainNameLowerCamel}${interfaceType}.insert(record) > 0 ? true : false;
    }
    /**
     *  Not empty new
     *  @Author ${author}
     *  @Date ${date}
     *  @param record Entity class
     */
    @Override
    public boolean insertSelective(${domainNameUpperCamel}${entity} record)  {
        return ${domainNameLowerCamel}${interfaceType}.insertSelective(record) > 0 ? true : false;
    }
    /**
     * A batch of new
     * @Author ${author}
     * @Date ${date}
     * @param  t An entity set
     */
    @Override
    public boolean insertBatch(List<${domainNameUpperCamel}${entity}> t) {
        return ${domainNameLowerCamel}${interfaceType}.insertBatch(t) > 0 ? true : false;
    }
    /**
     *  update
     *  @Author ${author}
     *  @Date ${date}
     *  @param record Entity class
     */
    @Override
    public boolean update(${domainNameUpperCamel}${entity} record)  {
        return ${domainNameLowerCamel}${interfaceType}.update(record) > 0 ? true : false;
    }
    /**
     *  Not empty update
     *  @Author ${author}
     *  @Date ${date}
     *  @param record Entity class
     */
    @Override
    public boolean updateSelective(${domainNameUpperCamel}${entity} record)  {
        return ${domainNameLowerCamel}${interfaceType}.updateSelective(record) > 0 ? true : false;
    }
    /**
     *  Physical deletion by ID
     *  @Author ${author}
     *  @Date ${date}
     *  @param id primary
     */
    @Override
    public boolean deleteById(${pkDataType} id){
        if(null == id){
          return false;
        }
        return ${domainNameLowerCamel}${interfaceType}.deleteById(id) > 0 ? true : false;
    }
    /**
     *  Batch Physical Deletion
     *  @Author ${author}
     *  @Date ${date}
     *  @param ids The primary key array
     */
    @Override
    public boolean deleteBatchById(List<${pkDataType}> ids){
        if(null == ids || ids.isEmpty()){
        return false;
        }
        return ${domainNameLowerCamel}${interfaceType}.deleteBatchById(ids) > 0 ? true : false;
    }
    /**
     *  Load by ID
     *  @Author ${author}
     *  @Date ${date}
     *  @param id primary
     */
    @Override
    public ${domainNameUpperCamel}${entity} findById(${pkDataType} id){
        if(null == id){
        return null;
        }
        return ${domainNameLowerCamel}${interfaceType}.findById(id);
    }
    /**
     * Get list data
     * @Author ${author}
     * @Date ${date}
     * @param pageNo page
     * @param pageSize size
     * @param params efault empty data set
     */
    @Override
    public PageInfo<${domainNameUpperCamel}${entity}> findPageList(Integer pageNo, Integer pageSize, Map<String, Object> params) {
        PageHelper.startPage(pageNo, pageSize);
        List<${domainNameUpperCamel}${entity}> dataList = ${domainNameLowerCamel}${interfaceType}.queryListAll(params);
        return PageInfo.of(dataList);
    }
}
